const { DataTypes } = require('sequelize');
const sequelize = require('@shared/utils/database');

const Banner = sequelize.define('Banner', {
  id: {
    type: DataTypes.BIGINT,
    primaryKey: true,
    autoIncrement: true,
    comment: '轮播图ID'
  },
  title: {
    type: DataTypes.STRING(32),
    allowNull: false,
    comment: '标题'
  },
  image: {
    type: DataTypes.STRING(256),
    allowNull: false,
    comment: '图片URL'
  },
  link: {
    type: DataTypes.STRING(256),
    allowNull: true,
    comment: '跳转链接'
  },
  sort: {
    type: DataTypes.INTEGER,
    allowNull: false,
    defaultValue: 0,
    comment: '排序'
  },
  status: {
    type: DataTypes.TINYINT,
    allowNull: false,
    defaultValue: 1,
    comment: '状态：0-禁用 1-正常'
  }
}, {
  tableName: 'banner',
  timestamps: true,
  createdAt: 'create_time',
  updatedAt: 'update_time'
});

module.exports = Banner; 